package com.framework.loippi.service.impl;

import com.framework.loippi.dao.ParameterSettingDao;
import com.framework.loippi.entity.ParameterSetting;
import com.framework.loippi.service.ParameterSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * SERVICE - ParameterSetting(参数设置)
 *
 * @author wmj
 * @version 2.0
 */
@Service
public class ParameterSettingServiceImpl extends GenericServiceImpl<ParameterSetting, Long> implements ParameterSettingService {

    @Autowired
    private ParameterSettingDao parameterSettingDao;


    @Autowired
    public void setGenericDao() {
        super.setGenericDao(parameterSettingDao);
    }

    @Override
    public String find(String key) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("aKey", key);
        List<ParameterSetting> result = parameterSettingDao.findByParams(map);
        return result != null && !result.isEmpty() ? result.get(0).getAValue() : "";
    }

    public List<ParameterSetting> findListByPage(Object parameter) {
        return parameterSettingDao.findListByPage(parameter);
    }

    public Long deletes(Object parameter) {
        return parameterSettingDao.deletes(parameter);
    }


}
